<template>
  <view class="search-container" :style="{ 'background-color':bgColor}" @click="searchBoxHandler">
    <view class="search-box" :style="{ 'border-radius':radius+'px'}">
      <uni-icons type="search" size="17"></uni-icons>
      <text class="placeholder">搜索</text>
    </view>
  </view>
</template>

<script>
  export default {
    name: "my-search",
    props: {
      bgColor: {
        type: String,
        default: '#c00000'
      },
      radius: {
        type: Number,
        default: 18 //px
      }
    },
    data() {
      return {

      };
    },
    methods:{
      searchBoxHandler(){
        console.log("触发自定义组件");
        this.$emit('click')
      }
    }
  }
</script>

<style lang="scss">
  .search-container {
    // background-color: #c00000;
    height: 50px;

    .search-box {
      width: 95%;
      height: 80%;
      margin: auto;
      background-color: #fff;
      display: flex;
      justify-content: center;
      align-items: center;

      // border-radius:18px ;
      .placeholder {
        margin-left: 5rpx;
      }
    }
  }
</style>